<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
var palindromePairs = function(words) {
    let res = [];
    for(let i = 0;i < words.length; i++){
        for(let j = 0;j < words.length; j++){
            if(i == j){
                continue;
            }
            let curr = words[i] + words[j];
            let start = 0;
            let end = curr.length -1 ;
            let ret = true;
            while(start < end){
                if(curr[start] != curr[end]) ret = false;
                start++;
                end--;
            }
            if(ret) res.push([i, j]);
        }
    }
    return res
};
console.log(palindromePairs(["a",""]));
  </script>
</body>
</html>